//
//  UIColor+RandomColorArray.m
//  biz
//
//  Created by LXL on 2017/6/8.
//  Copyright © 2017年 jieshuibao. All rights reserved.
//

#import "UIColor+RandomColorArray.h"

@implementation UIColor (RandomColorArray)
+ (NSArray *)randomColorWithColorArray:(NSArray *)colorArray {
    if (!colorArray || !colorArray.count) {
        return nil;
    }
    
    NSMutableArray *newArr = [NSMutableArray new];
    while (newArr.count != colorArray.count) {
        //生成随机数
        int x =arc4random() % colorArray.count;
        id obj = colorArray[x];
        if (![newArr containsObject:obj]) {
            [newArr addObject:obj];
        }
    }
    
    return newArr;
}
@end
